/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.master.satuan;

import com.buanalintas.bynga.Dictionary;
import com.buanalintas.bynga.Field;
import com.buanalintas.bynga.Page;
import com.ronsicecream.pos.entities.PosMasterSatuan;


/**
 *
 * @author dedy
 */
public class Satuan  extends Page {

    private Field satuanId;
    private Field satuanCode;
    private Field satuanName;

    public Satuan() {
        setTheClass(PosMasterSatuan.class);

        satuanId = new Field();
        satuanId.setName("satuanId");
        satuanId.setCaption("id");
        satuanId.setListProperties(" align=\"right\" width=\"5%\" nowrap");
        satuanId.setInputProperties(" size=\"20\"");
        getFields().add(satuanId);

        satuanCode = new Field();
        satuanCode.setName("satuanCode");
        satuanCode.setCaption("code");
        satuanCode.setListProperties(" align=\"center\" width=\"10%\" nowrap");
        satuanCode.setInputProperties(" size=\"20\"");
        getFields().add(satuanCode);

        satuanName = new Field();
        satuanName.setName("satuanName");
        satuanName.setCaption("name");
        satuanName.setListProperties(" align=\"left\" width=\"80%\" nowrap");
        satuanName.setInputProperties(" size=\"30\"");
        satuanName.setRequired(true);
        satuanName.setInputCase(Field.CASE_UPPER);
        getFields().add(satuanName);

        fillFields();

        getFieldsUnique().add(new Field[]{satuanCode});

        getFieldsAdd().remove(satuanId);
        getFieldsEdit().remove(satuanId);
        getFieldsList().remove(satuanId);
        
        setExportList(getClass().getResourceAsStream("SatuanList.jasper"));
        setExport(getClass().getResourceAsStream("Satuan.jasper"));
        getController().setOrder(satuanCode);
    }

    @Override
    public void beforeExport() {
        getExportParams().put("title", Dictionary.getValue(this, "Satuan"));
    }

    @Override
    public void beforeExportMulti() {
        beforeExport();
    }
}
